home *** CD-ROM | disk | FTP | other *** search
- Path: rcp6.elan.af.mil!rscernix!danpop
- From: danpop@mail.cern.ch (Dan Pop)
- Newsgroups: comp.lang.c
- Subject: Re: Unbuffered character input...
- Date: 8 Feb 96 20:36:55 GMT
- Organization: CERN European Lab for Particle Physics
- Message-ID: <danpop.823811815@rscernix>
- References: <Pine.SGI.3.91.960129190205.27936A-100000@tahiti.cs.unm.edu> <9602022043.AA13287@dxmint.cern.ch> <4f7hlf$87n@airdmhor.gen.nz> <9602061701.AA21789@dxmint.cern.ch> <4f8kat$ofv@solutions.solon.com> <823794347snz@genesis.demon.co.uk>
- NNTP-Posting-Host: ues5.cern.ch
- X-Newsreader: NN version 6.5.0 #7 (NOV)
-
- In <823794347snz@genesis.demon.co.uk> Lawrence Kirby <fred@genesis.demon.co.uk> writes:
-
- >In article <4f8kat$ofv@solutions.solon.com>
- > seebs@solutions.solon.com "Peter Seebach" writes:
- >
- >>In article <9602061701.AA21789@dxmint.cern.ch>,
- >>Dan Pop <danpop@mail.cern.ch> wrote:
- >>>But even on systems where it is not, it still saves processor time.
- >>>The cpu overhead of making a single OS call to get a complete line of input
- >>>is smaller (sometimes significantly smaller) than the overhead of making
- >>>N OS calls, one for each character of the line. The stdio library tries
- >>>to do its best to minimize the number of (expensive) OS calls.
- >
- >The stdio library typically reads characters as soon as they are available
- >so it does very little in this respect except provide suitable buffering
- >when more than one character happens to be available on a read. This is
- >clearly significant for file I/O but whether terminal I/O makes user typed
- >characters immediately available or not is usually purely a function of the
- >OS. Setting line buffering on input streams on many/most stdio libraries
- >doesn't do anything special.
-
- Because the line buffering is performed by the tty driver. The tty driver
- won't (unless explicitly asked) make characters available as soon as they
- are typed and the stdio library doesn't attempt to get them as soon as
- they're typed. It looks like line buffered terminal input to me, unless
- I'm missing something.
-
- Dan
- --
- Dan Pop
- CERN, CN Division
- Email: danpop@mail.cern.ch
- Mail: CERN - PPE, Bat. 31 R-004, CH-1211 Geneve 23, Switzerland
-